package com.jida.tijian.controller;

import com.jida.tijian.dto.CalendarRequestDto;
import com.jida.tijian.dto.ResponseObject;
import com.jida.tijian.service.CalendarService;
import com.sun.net.httpserver.HttpServer;
import org.apache.coyote.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class CalendarController {
    /**
     * 请求对象：刚才我们模拟了
     * 参数：年份 月份 医院编号
     *
     * 响应对象：前端请求日历需要的数据的结构
     *
     * 一是：  对应年份和月份的日历
     *
     * 二时：对应挂号规则的  余号信息
     * 挂号只能挂余后的号，明天开始且30天以内的号
     */
    @Autowired
    CalendarService calendarService;

    @RequestMapping("/listCalendar")

    public ResponseObject listCalendar(@RequestBody CalendarRequestDto calendarRequestDto){

        return new ResponseObject(ResponseObject.SUCCESS_STATUS,ResponseObject.SUCCESS_DESC,
                calendarService.listAppointmentCalendar(calendarRequestDto));
       // return null;
    }

//    @Autowired
//    CalendarService calendarService;
//
//    @RequestMapping("/listAppoinmentCalendar")
//    public ApiResponse listAppoinmentCalendar(@RequestBody CalendarRequestDto calendarRequestDto, HttpServletRequest request){
//        return new ApiResponse(ApiResponse.SUCCESS_STATUS,ApiResponse.SUCCESS_DESC,calendarService.listAppointmentCalendar(calendarRequestDto));
//    }
//
//    @RequestMapping("/listAppoinmentCalendar2")
//    public ApiResponse list2(){
//        return new ApiResponse(ApiResponse.SUCCESS_STATUS,ApiResponse.SUCCESS_DESC,calendarService.listAppointmentCalendar(calendarRequestDto));
//    }

}
